import { Image as ImageLayer, Group as LayerGroup } from "ol/layer";
import { ImageStatic } from "ol/source";

/**
 * 添加本地图片图层
 */
export function getLocalImage() {
  // 降雨图1
  const rainImageLayer1 = new ImageLayer({
    properties: {
      name: "降雨图1号",
      id: "rainfall_1",
    },
    source: new ImageStatic({
      url: "src/examples/图层/图片图层/img/rainfall_1.png",
      imageExtent: [109.654314, 20.21473, 117.31375, 26.087337],
    }),
  });

  // 降雨图2
  const rainImageLayer2 = new ImageLayer({
    properties: {
      name: "降雨图2号",
      id: "rainfall_2",
    },
    source: new ImageStatic({
      url: "src/examples/图层/图片图层/img/rainfall_2.png",
      imageExtent: [109, 20, 117, 26],
    }),
  });

  return new LayerGroup({
    properties: {
      name: "降雨图",
      id: "rainfall",
    },
    layers: [rainImageLayer1, rainImageLayer2],
    zIndex: 10,
  });
}
